local beishi = fk.CreateSkill{
  name = "hanqing__beishi",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["hanqing__beishi"] = "备势",
  [":hanqing__beishi"] = "锁定技，当你受到伤害后，你摸X张牌并废除一个装备栏（X为你未废除的装备栏数）。",

  ["#hanqing__beishi-abort"] = "备势：废除一个装备栏",
}

beishi:addEffect(fk.Damaged, {
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(beishi.name) and #player:getAvailableEquipSlots() > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(#player:getAvailableEquipSlots(), beishi.name)
    if player.dead or #player:getAvailableEquipSlots() == 0 then return end
    local choice = room:askToChoice(player, {
      choices = player:getAvailableEquipSlots(),
      skill_name = beishi.name,
      prompt = "#hanqing__beishi-abort",
    })
    room:abortPlayerArea(player, choice)
  end,
})

return beishi
